<style>
    .height44{display:none;}.goods-name{height:15px;overflow: hidden;line-height:15px;}
         /*商城评价星星*/
     .store_eval div { padding-left: 30%;}
    .store_eval em{ display: block; width:70px;height:12px;background:url(<?php echo TEMPLATES_PATH;?>/images2/rate_star.gif) repeat-x left top;margin-top: 8px;}
    .store_eval i{display: block; height:12px;background:url(<?php echo TEMPLATES_PATH;?>/images2/rate_star.gif) repeat-x left bottom;}
    /*商城认证图标*/
    #certAutonym{background-position: 2px 0px}
    #certAutonym_no{background-position: -29px -24px}
    #cert_store{background-position: -32px 0px}
    #cert_store_no{background-position: 0px -24px}
    #mdt_pass{background-position: -63px 0px}
    #mdt_pass_no{background-position: -61px -24px}
</style>

<!--商城headS-->
<div class="store-head layout text-center text-white ">
    <div class="store-img padding-top">
    	<span class="border border-white radius-circle padding-small inlineBlock">
        	<img src="<?php echo $output['store_info']['store_logo'];?>" alt="<?php echo $output['store_info']['store_name']; ?>" class="img-border border-white radius-circle">
        </span>
    </div>
    <div class="store-name text-big margin-snall"><?php echo $output['store_info']['store_name']; ?></div>
    <div class="margin height text-center clearfix">
        <a href="javascript:;" class=" x4 text-white collect" data-store_id="<?php echo $output['store_info']['store_id']?>"><i class="icon-heart margin-right"></i><span></span></a>
        <a href="javascript:;" class=" x4 text-white dialogs" data-toggle="click" data-target="#share-store" data-mask="1" data-width="60%"><i class="icon-share-alt margin-right"></i>分享</a>
        <a href="javascript:;" title="<?php echo $output['store_info']['store_tel']; ?>" class=" x4 text-white"><i class="icon-phone margin-right"></i>联系卖家</a>
    </div>
</div>
<!-- 分享商城对话框 -->
<div id="share-store">
    <div class="dialog">
        <div class="dialog-head">
            <span class="close rotate-hover"></span>
            <strong>分享：</strong>
        </div>
        <div class="dialog-body">
            <ul class="">
                <li>
                    <a href="javascript:;" id="">
                        <img src="<?php echo SiteUrl.DS.ATTACH_STORE.DS.$output['store_info']['store_code']?>" />
                    </a>
                    <p>商城二维码</p>
                </li>
                <!--<li>
                    <a href="javascript:;" id="sina" target="_blank">
                        <img src="">
                    </a>
                    <p>新浪微博</p>
                </li><div class="divider"></div>-->
            </ul>
        </div>
        <div class="dialog-foot">
            <button class="button dialog-close">取消</button>
            <button class="button bg-green dialog-close">确认</button>
        </div>
    </div>
</div>

<div class="bg-white clearfix text-center store-btn">
    <a href="javascript:;" class="x3 padding <?php echo isset($_GET['url_type'])?'':'border-bottom border-ef7f7e text-ef7f7e'; ?>">商城商品</a>
    <a href="javascript:;" class="x3 padding">商品分类</a>
    <a href="javascript:;" class="x3 padding">商城评价</a>
    <a href="javascript:;" class="x3 padding <?php echo isset($_GET['url_type'])?'border-bottom border-ef7f7e text-ef7f7e':''; ?>">商城详情</a>
</div>
<!--商城headE-->
<div class="store-goods" style="display: <?php echo isset($_GET['url_type'])?'none':'block'; ?>;">
    <!--商城搜索框S-->
    <div class="padding store-o-select layout fixed">
        <form method="get" id="form-search" class="bg-white radius-big " style="overflow: hidden;">
             <input type="hidden" name="act" value="show_store" />
            <input type="hidden" name="id" value="<?php echo $output['store_info']['store_id'];?>" />
            <div class="x10" style="padding: 9px; border: 1px solid #E33; border-radius: 6px 0 0 6px;">
                <i class="icon-search text-gray float-left"></i>
                <input id="keywords" name="keyword" value="<?php echo $_GET['keyword']?>" class="border-none text-small padding-small-left x11" placeholder="搜索商城里的商品">
            </div>
            <input type="button"  onclick="if($('input[id=keywords]').val()!='')$('#form-search').submit()" class="x2 bg-red padding text-white text-center border-none " value="搜索">
        </form>
    </div>
    <!--商城搜索框E-->
    <!--商城商品展示tabS-->
    <div class="radius-big bg-white margin padding clearfix text-center" id="store-goods-tab">
        <a href="javascript:;" onclick="changeOrder(this)" data-tp="new" class="x20 <?php if($_GET['key']=='new'){echo 'text-red';}?>">新品<?php echo ($_GET['order']=='desc' && $_GET['key']=='new')?'↑':(($_GET['order']=='asc' && $_GET['key']=='new')?'↓':'')?></a>
        <a href="javascript:;" onclick="changeOrder(this)" data-tp="sale" class="x20 <?php if($_GET['key']=='sale'){echo 'text-red';}?>">销量<?php echo ($_GET['order']=='desc' && $_GET['key']=='sale')?'↑':(($_GET['order']=='asc' && $_GET['key']=='sale')?'↓':'')?></a>
        <a href="javascript:;" onclick="changeOrder(this)" data-tp="price" class="x20 <?php if($_GET['key']=='price'){echo 'text-red';}?>">价格<?php echo ($_GET['order']=='desc' && $_GET['key']=='price')?'↑':(($_GET['order']=='asc' && $_GET['key']=='price')?'↓':'')?></a>
        <a href="javascript:;" onclick="changeOrder(this)" data-tp="credit" class="x20 <?php if($_GET['key']=='credit'){echo 'text-red';}?>">信用<?php echo ($_GET['order']=='desc' && $_GET['key']=='credit')?'↑':(($_GET['order']=='asc' && $_GET['key']=='credit')?'↓':'')?></a>
        <a href="javascript:;" onclick="changeOrder(this)" data-tp="click" class="x20 <?php if($_GET['key']=='click'){echo 'text-red';}?>">人气<?php echo ($_GET['order']=='desc' && $_GET['key']=='click')?'↑':(($_GET['order']=='asc' && $_GET['key']=='click')?'↓':'')?></a>
    </div>
    <!--商城商品展示tabE-->
    <script>
        /*点击排序事件*/
        function changeOrder(obj){
            var key = $('input[name=key]');
            var order = $('input[name=order]');
            if($(obj).data('tp') == key.val()){
              if(order.val() == 'desc'){
                    order.val('asc');
                }else {
                    order.val('desc');
                }
            }else{
                key.val($(obj).data('tp'));
                order.val('desc');
            }
            $('#condtion').submit();
        }
    </script>
    <form id="condtion" method="get">
        <input type="hidden" name="act" value="show_store" />
        <input type="hidden" name="id" value="<?php echo $output['store_info']['store_id'];?>" />
        <input name="keyword" value="<?php echo $_GET['keyword']?>" type="hidden">
        <input name="stc_id" value="<?php echo (int)$_GET['stc_id']?>" type="hidden"><!--商品分类-->
        <input name="key" value="<?php echo $_GET['key'];?>" type="hidden" /><!--排序类型-->
        <input name="order" value="<?php echo $_GET['order'];?>" type="hidden" />
    </form>
    <!--商品展示S-->
    <div class="margin">
        <?php if(!empty($output['goods_list']) && is_array($output['goods_list'])){?>
            <ul class="clearfix padding-none store-goods-list">
            <?php foreach($output['goods_list'] as $k=>$v){?>
            <li class="x6 ">
                <a href="index.php?act=goods&goods_id=<?php echo $v['goods_id']?>">
                    <dl class="clearfix radius-big bg-white">
                        <dt><img src="<?php echo SiteUrl.DS.ATTACH_GOODS.DS.$v['store_id'].DS.$v['goods_image'];?>" onerror="this.src='<?php echo TEMPLATES_PATH;?>/images/touch2013/no_140_140.jpg'"  alt="<?php echo $v['goods_name']?>" width="100%" onload="imgheqw(this)"></dt>
                        <dd>
                            <h6 class="ycyc"><?php echo $v['goods_name']?></h6>
                            <div><span class="goods-price text-red text-big"><?php if($_SESSION['is_login'] != 1){?>
                                        登录后显示
                                    <?php }else{?>
                                        &yen;
						 <?php
                                        if($v['group_flag']==0 && $v['xianshi_flag']==0){
                                            echo $v['goods_store_price'];
                                        }else if($v['group_flag']==1 && $v['xianshi_flag']==0){
                                            echo $v['group_price'];
                                        }else if($v['group_flag']==0 && $v['xianshi_flag']==1){
                                            echo ncPriceFormat($v['goods_store_price']*($v['xianshi_discount']/10));
                                        }else if($v['group_flag']==1 && $v['xianshi_flag']==1){
                                            if($v['group_price'] < ($v['goods_store_price']*($v['xianshi_discount']/10))){
                                                echo $v['group_price'];
                                            }else{
                                                echo ncPriceFormat($v['goods_store_price']*($v['xianshi_discount']/10));
                                            }
                                        }
                                        ?>
                        <?php }?></span></div>
                        </dd>
                    </dl>
                </a>
            </li>
            <?php }?>
        </ul>
        <?php }else{?>
            <ul> <li class="noTxt">
                    <div class="text-center text-gray padding-large">
                        <i class="icon-meh-o"></i>
                        <p>暂无相关的数据记录。</p>
                    </div>
                </li></ul>
        <?php }?>
    </div>
    <!--商品展示E-->
    <div style="display: <?php echo isset($_GET['url_type'])?'none':'block'; ?>;">
    <?php require_once 'page.php';?></div>
</div>
<!--商品分类选项卡下内容 S-->
<div class="store-gclass bg-white margin radius-big " style="display:none;">
    <?php if(!empty($output['goods_class_list']) && is_array($output['goods_class_list'])){?>
    <?php foreach($output['goods_class_list'] as $value){?>
    <div class="bg-white  margin padding radius-big goods-list">
    <h5><a href="javascript:void(0)"  onclick="changeCat(<?php echo $value['stc_id'];?>)"><?php echo $value['stc_name'];?></a>
        <?php if(!empty($value['children']) && is_array($value['children'])){?>
        <i class="float-right icon-angle-up icon-angle-down"></i>
        <?php }?>
    </h5>
        <?php if(!empty($value['children']) && is_array($value['children'])){?>
    <hr>
    <p class="clearfix text-center text-small">
        <?php foreach($value['children'] as $value1){?>
        <a href="javascript:void(0)" class="padding-small" onclick="changeCat(<?php echo $value1['stc_id'];?>)"><?php echo $value1['stc_name'];?></a>
        <?php }?>
    </p>
        <?php }?>
    </div>
    <?php }}else{?>
        <ul> <li class="noTxt">
                <div class="text-center text-gray padding-large">
                    <i class="icon-meh-o"></i>
                    <p>暂无商品分类</p>
                </div>
            </li></ul>
    <?php }?>
    </div>
<!-- 评价下内容 -->
<div class="store-assess bg-white margin radius-big " style="display:none;">
    <div class=" padding height-big store_eval ">
        <div class="clearfix"><span class="float-left">产品品质：</span>
            <em class="float-left margin-right" > <i style="width:<?php echo $output['store_info']['goods_quality_credit'];?>%"></i></em><?php echo $output['store_info']['goods_quality_credit'];?> 分
        </div>
        <div class="clearfix"><span class="float-left">包装品质：</span>
            <em class="float-left margin-right" > <i style="width:<?php echo $output['store_info']['package_quality_credit'];?>%"></i></em><?php echo $output['store_info']['package_quality_credit'];?> 分
        </div>
        <div class="clearfix"><span class="float-left">发货速度：</span>
            <em class="float-left margin-right" > <i style="width:<?php echo $output['store_info']['shipping_speed_credit'];?>%"></i></em><?php echo $output['store_info']['shipping_speed_credit'];?> 分
        </div>
        <div class="clearfix"><span class="float-left">售后服务：</span>
            <em class="float-left margin-right" > <i style="width:<?php echo $output['store_info']['after_sale_credit'];?>%"></i></em><?php echo $output['store_info']['after_sale_credit'];?>
            分
        </div>
    </div>
</div>
<!-- 商城详情 -->
<div class="store-news bg-white padding margin-top" style="display: <?php echo isset($_GET['url_type'])?'block':'none'; ?>;">
    <div class="height">商城等级：<span class="text-red"><?php echo $output['store_info']['grade_name'];?></span></div>
    <div class="clearfix"><i class="float-left">认证信息:&nbsp;</i>
    	<div class="float-left"  id="<?php if($output['store_info']['name_auth']==NAME_AUTH_PASS){echo 'certAutonym';}else{echo 'certAutonym_no';}?>">实名认证&nbsp;</div>
    	<div class="float-left" id="<?php if($output['store_info']['store_auth']==STORE_AUTH_PASS){echo 'cert_store';}else{echo 'cert_store_no';}?>">实体商城认证&nbsp;</div>
    	<div class="float-left" id="<?php if($output['store_info']['store_mdt_status']==STORE_MDT_STATUS_PASS){echo 'mdt_pass';}else{echo 'mdt_pass_no';}?>" >美达通服务</div></div>
    <?php if(($output['store_info']['store_id']==OFFICIAL_STORE_ID) || ($output['store_info']['store_id'] ==JKY_STORE_ID)){ ?>
    <div class="height">商城信誉：
        <span class="text-red">官方商城</span></div> <?php }else{?>
    <div class="height">卖家信用：
        <span class="text-red"><?php echo $output['store_info']['store_credit'];?></span></div><?php }?>
    <div class="height ">联系方式
        <p>所 在 地：<span><?php echo $output['store_info']['area_info'];?></span></p>
        <p>详细地址：<span class=""><?php echo $output['store_info']['store_address'];?></span></p>
        <p>联系电话：<span><?php echo $output['store_info']['store_tel'];?></span></p>
        <p>电子邮件：<span><?php echo $output['member_info']['member_email'];?></span></p>
    </div>
    <hr class="bg-ef7f7e">
    <?php echo htmlspecialchars_decode($output['store_info']['description']);?>
    <div class="text-center"><img src="<?php echo SiteUrl.DS.ATTACH_STORE.DS.$output['store_info']['store_code']?>" onerror="this.src='<?php echo SiteUrl.DS.ATTACH_STORE.DS.'default_qrcode.png';?>'" onload="javascript:DrawImage(this,90,90);"></div>
</div>
<script type="text/javascript">
    function changeCat(id){
        $('input[name=stc_id]').val(id);
        $('#condtion').submit();
    }
    $(function(){
        /*点击收藏事件：添加收藏，返回成功后将收藏图标变为红色*/
        $('.collect').bind('click',function(){
            if($('.collect i').hasClass('text-ef7f7e')){
                alert('您已经收藏过该商城了');return false;
            }
            var store_id = $(this).data('store_id');
            $.post('index.php?act=show_store&op=ajax_fav_store',{'store_id':store_id},function(data){
                if(data.state==true){
                    alert(data.msg);
                    $('.collect i').removeClass('icon-heart-o').addClass('text-ef7f7e').next('span').text('已收藏');
                }else{
                    alert(data.msg);
                }
            },'json');
        })
        //商城收藏 或 没收藏样式提示
        <?php if(in_array($_SESSION['member_id'],$output['m_id'])){?>
                 $('.collect i').addClass('text-ef7f7e').next('span').text('已收藏');
        <?php }else{?>
                  $('.collect i').addClass('icon-heart-o').next('span').text('收藏');
        <?php }?>

        $('.store-btn a').bind('click',function(){
            var $sg = $('.store-goods'),
                $stc = $('.store-gclass'),
                $sa = $('.store-assess'),
                $sn = $('.store-news'),
                a = $(this).index();
            $(this).addClass('border-bottom border-ef7f7e text-ef7f7e').siblings().removeClass('border-bottom border-ef7f7e text-ef7f7e');
            if(a==0){
                $sg.show();
                $sa.hide();
                $sn.hide();
                $stc.hide();
            }else if(a==1){
                $stc.show();
                $sg.hide();
                $sn.hide();
                $sa.hide();
            }else if(a==2){
                $sa.show();
                $sg.hide();
                $sn.hide();
                $stc.hide();
            }else{
                $sn.show();
                $sa.hide();
                $sg.hide();
                $stc.hide();
            }

        })
        //商品名称过长时的处理
        deal_words($('.ycyc'),1);
    })
</script>